<admintpl file="header" />
</head>
<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:U('Groups/index')}">群组管理</a></li>
            <li><a href="{:U('Groups/add')}">添加群组</a></li>
            <li class="active"><a>修改群组</a></li>
        </ul>
            <div class="row-fluid">
                <div class="span4">
        			<form action="{:U('Groups/edit_post')}" method="post" class="form-elem js-ajax-form" enctype="multipart/form-data">
                    <table class="table table-bordered">
                        <tr>
                            <th>名称</th>
                            <td>
								<input type="hidden" name="aid" value="{$area.id}"/>
                                <input type="text" name="area_name" required value="{$area.area_name}" autocomplete="off"/>
                            </td>
                        </tr>
                        <tr>
                            <th>介绍</th>
                            <td>
                                <input type="text" name=" area_description" required value="{$area.area_description}" autocomplete="off"/>
                            </td>
                        </tr>
                        <tr>
                            <th>区域类型</th>
                            <td>
								<label class="radio">
									<input type="radio" name="area_type" value="1"disabled <if condition="$area['area_type'] eq 1">checked</if>>
									<span>自选设备</span>
								</label>
								<label class="radio">
									<input type="radio" name="area_type" value="2"disabled <if condition="$area['area_type'] eq 2">checked</if>>
									<span>自选坐标</span>
								</label>
								<label class="radio">
									<input type="radio" name="area_type" value="3"disabled <if condition="$area['area_type'] eq 3">checked</if>>
									<span>自选城市</span>
								</label>
								<label class="radio">
									<input type="radio" name="area_type" value="4"disabled <if condition="$area['area_type'] eq 4">checked</if>>
									<span>批量导入</span>
								</label>
                            </td>
                        </tr>
                        <tr>
                            <th>是否锁定</th>
                            <td>
								<label class="radio">
									<input type="radio" name="area_locking" value="0"disabled <if condition="$area['area_locking'] eq 0">checked</if>>
									<span>不锁定</span>
								</label>
								<label class="radio">
									<input type="radio" name="area_locking" value="1"disabled <if condition="$area['area_locking'] eq 1">checked</if>>
									<span>锁定</span>
								</label>
                            </td>
                       </tr>
                        <tr>
                            <th>是否启用</th>
                            <td>
								<label class="radio">
									<input type="radio" name="status" value="0" <if condition="$area['status'] eq 0">checked</if>>
									<span>不启用</span>
								</label>
								<label class="radio">
									<input type="radio" name="status" value="1" <if condition="$area['status'] eq 1">checked</if>>
									<span>启用</span>
								</label>
                            </td>
                       </tr>
                    </table>
		            <div class="form-actions">
				    	<button class="btn btn-primary js-ajax-submit" type="submit">提交修改</button>
		                <a class="btn" href="{:U('Groups/index')}">返回</a>
		            </div>
		            <div class="form-actions">
		            	<a class="btn btn-primary" type="submit" href="{:U('Groups/add_device',array('source'=>'edit','aid'=>$area['id'],'area_type'=>$area['area_type']))}"/>添加信息</a>
		            </div>
		        </form>
                </div>

                <div class="span8">
                    <table class="table table-bordered">
                <if condition="$area['area_type'] eq 1 || $area['area_type'] eq 4">
					<thead>
		                <tr>
	                        <th>店铺名称/店铺地址</th>
	                        <th>设备ID/条形码</th>
	                        <th>major/minor</th>
	                        <th>设备类型/设备状态</th>
		                    <th width="40">操作</th>
		                </tr>
		           </thead>
                    <foreach name="devices" item="vo">
	                    <tr>
	                    	<td>
	                        	<foreach name="stores" item="st">
									<if condition="$st['store_id'] eq $vo['store_id']" >
										<a href="{:U('Asset/Store/edit', array('id'=>$st['id']))}">{$st.title}({$st.title_branch})</a>
										 - {$stype[$st['stype']]['name']}
										<br>{$st.address}
									</if>
	                           </foreach>
	                        </td>
	                        <td>{$vo.devid}<br>{$vo.barcode}</td>
	                        <td>{$vo.major}<br>{$vo.minor}</td>
							<td>{$bstatus[$vo['status']]['name']}<br>{$vo.livetime}</td>
							<td><a href="{:U('Groups/delete_device',array('aid'=>$area['id'],'bid'=>$vo['id']))}" class="js-ajax-delete">{:L('DELETE')}</a><br>{$vo['locking']==1?"已锁定":"未锁定"}</td>
                       </tr>
                   </foreach>
				<else />
					<thead>
		                <tr>
		                    <th>查询内容</th>
		                    <th width="80">点击查看</th>
		                    <th width="75">操作</th>
		                </tr>
		           </thead>
                    <foreach name="abids" item="vo">
                        <tr>
							<td>{$vo.value_a},{$vo.value_b},{$vo.value_c},{$vo.value_d}</td>
							<td>
								<label class="radio" style="float: right;">
									<input type="radio" name="id" value="{$vo.id}" title="ID:{$vo.id}" class="js-articles-move">
									<span>查看地图</span>
								</label>
							</td>
							<td><a href="{:U('Groups/delete_area',array('aid'=>$area['id'],'id'=>$vo['id']))}" class="js-ajax-delete">{:L('DELETE')}</a> | {$vo['locking']==1?"已锁定":"未锁定"}</td>
                       </tr>
                   </foreach>
                </if>
                   </table>
                   <div class="pagination">{$page}</div>
                </div>
            </div>
    </div>
    <script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
    	<script>
		$(function() {
			Wind.use('ajaxForm', 'artDialog', 'iframeTools', function() {
				//批量移动
				$('.js-articles-move').click(function(e) {
					var id = $('input[name="id"]:checked ').val();
					art.dialog.open("__ROOT__/index.php?g=Operations&m=Groups&a=map&id="+ id, {
						title : "查看地图",
						width : "60%",
						height:"500px"
					});
				});
			});
		});
	</script>
</body>
</html>
